import {Analyser} from "./interface";
import cheerio from 'cheerio';

class BaiduAnalyser implements Analyser {
    analyse(str: string): object {
        let $ = cheerio.load(str);
        let arr:any = [];
        $('li.hotsearch-item').each(function(this: cheerio.Element){
            arr.push($(this).text())
        });
        return {
            time: Date.now(),
            data: arr
        };
    }
}

export default BaiduAnalyser;
